<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Registration Page</title>
    </h:head>
    <h:body>
        <ui:composition template="./templateuser.xhtml">
            <ui:define name="center">
                <h:form>
                    <p:panel header="Profile Information">
                        <h:panelGrid columns="3" id="profileGrid">
                            <h:outputLabel for="name">Name:</h:outputLabel>
                            <p:inputText id="name" value="#{modifyProfileBean.user.name}">
                                <p:ajax update="namemsg"/>
                            </p:inputText>
                            <p:message id="namemsg" for="name" />

                            <h:outputLabel for="surname">Surname:</h:outputLabel>
                            <p:inputText id="surname" value="#{modifyProfileBean.user.surname}">
                                <p:ajax update="surnamemsg"/>
                            </p:inputText>
                            <p:message id="surnamemsg" for="surname" />

                            <h:outputLabel for="email">Email:</h:outputLabel>
                            <p:inputText id="email" value="#{modifyProfileBean.user.email}" >
                                <p:ajax update="emailmsg"/>
                            </p:inputText>
                            <p:message id="emailmsg" for="email" />

                            <h:outputLabel for="address">Address:</h:outputLabel>
                            <p:inputText id="address" value="#{modifyProfileBean.user.address}" >
                                <p:ajax update="addressmsg"/>
                            </p:inputText>
                            <p:message id="addressmsg" for="address" />

                            <h:outputLabel for="telnumber">Telephone number:</h:outputLabel>
                            <p:inputText id="telnumber" value="#{modifyProfileBean.user.telnumber}" >
                                <p:ajax update="telnumbersmsg"/>
                            </p:inputText>
                            <p:message id="telnumbersmsg" for="telnumber" />
                            
                            <h:outputLabel for="calendarvisibility">Public calendar:</h:outputLabel>
                            <p:selectBooleanCheckbox id ="calendarvisibility" value="#{modifyProfileBean.user.calendarvisibility}">
                            </p:selectBooleanCheckbox>

                        </h:panelGrid>
                        
                        <p:toolbar style="margin-top: 20px">
                            <p:toolbarGroup align="right">
                                <p:commandButton value="Save" update="profileGrid"
                                 action="#{modifyProfileBean.save()}" />
                            </p:toolbarGroup>
                        </p:toolbar>
                        
                    </p:panel>
                </h:form>
            </ui:define>
        </ui:composition>
    </h:body>
</html>
